package com.ibm.risk.irmp.rule.client;

import com.ibm.risk.irmp.rule.model.SourceRuleDomain;
import com.ibm.risk.irmp.rule.service.RuleEngineService;
import com.ibm.risk.irmp.rule.vo.RuleResult;
import com.ibm.risk.irmp.rule.vo.RuleSumResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;

import java.util.List;
import java.util.Map;

@HttpExchange("/rules")
public interface RuleEngineServiceClient extends RuleEngineService {
    @Override
    @PostExchange("/gen")
    String genRuleScript(@RequestBody SourceRuleDomain sourceRuleDomain) throws Exception;

    @PutMapping("/deploy")
    @Override
    void deployRuleDomain(@RequestBody SourceRuleDomain sourceRuleDomain) throws Exception;

    @Override
    @PostExchange("/fire/domains/{domain}")
    RuleSumResult fireRule(@PathVariable String domain, @RequestBody Map<String, Object> params);

    @Override
    @PostExchange("/execute/domains/{domain}")
    RuleResult<?> executeRules(@PathVariable String domain, @RequestBody List<Map<String, Object>> dataList) throws Exception;
}
